package cn.backpackerxl.server.impl;
import cn.backpackerxl.model.Teacher;
import cn.backpackerxl.server.TeacherService;
import cn.backpackerxl.repo.TeacherDao;
import cn.backpackerxl.easyJDBC.main.EasyJDBCRepository;

import java.util.List;
/**
 * @Author: backpackerxl
 * CreateTime: 2022/11/24
 * FileName: TeacherServiceImpl
 **/
public class TeacherServiceImpl implements TeacherService {
	private final TeacherDao teacherdao = (TeacherDao) new EasyJDBCRepository(TeacherDao.class).init();

	@Override
	public int add(Teacher teacher) {
		return teacherdao.save(teacher);
	}

	@Override
	public int edit(Teacher teacher) {
		return teacherdao.update(teacher);
	}

	@Override
	public int delete(Long id) {
		return teacherdao.remove(id);
	}

	@Override
	public Teacher selectById(Long id) {
		return teacherdao.findById(id);
	}

	@Override
	public List<Teacher> selectAll() {
		return teacherdao.findAll();
	}

}